]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
swipeTracker: Flip pan gesture velocity in RTL locales
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Nov 2025 14:51:23 +0000 (15:51 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 24 Nov 2025 13:42:59 +0000 (14:42 +0100)
Like the gesture delta, the final velocity needs to be flipped in
RTL locales, otherwise we end up cancelling out the gesture progress.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3967>
(cherry picked from commit 799a842d3a11b9d0df0e69d2d6a07ce66f926ba2)

js/ui/swipeTracker.js

index 18f6657db18b39d56488b5bab97e3e51e6b9d51d..16138622b9c566f16674b98c47da899eec990eb1 100644 (file)
@@ -653,8 +653,8 @@ export const SwipeTracker = GObject.registerClass({
     _endPanGesture(panGesture) {
         const velocity = panGesture.get_velocity();
         const v = this.orientation === Clutter.Orientation.HORIZONTAL
-            ? -velocity.get_x()
-            : -velocity.get_y();
+            ? this._getGestureDirFactor() * velocity.get_x()
+            : this._getGestureDirFactor() * velocity.get_y();
 
         this._endGesture(v, this._distance, false);
     }
@@ -679,6 +679,14 @@ export const SwipeTracker = GObject.registerClass({
         this._endGesture(0, this._distance, false);
     }
 
+    _getGestureDirFactor() {
+        if (this.orientation === Clutter.Orientation.HORIZONTAL &&
+            Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
+            return 1;
+
+        return -1;
+    }
+
     /**
      * Confirms a swipe. User has to call this in 'begin' signal handler,
      * otherwise the swipe wouldn't start. If there's an animation running,